package com.gexin.model.activity;

import com.gexin.model.activity.base.BaseCashCouponLog;
import org.apache.logging.log4j.core.util.UuidUtil;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 业务名称:  t_cash_coupon_log() 
 */
@SuppressWarnings("serial")
public class CashCouponLog extends BaseCashCouponLog<CashCouponLog> {
	public static final CashCouponLog dao = new CashCouponLog();



	public void setCommonCoin(String userId, BigDecimal increment, boolean incomeOr, int type, String desc,int entryType){
		this.setId(UuidUtil.getTimeBasedUuid()+"");
		this.setType(type);
		this.setIncomeOr(incomeOr);
		this.setCoin(increment);
		this.setUserId(userId);
		this.setCashCoupon(0);
		this.setDesc(desc);
		this.setEntryType(entryType);
		long date = new Date().getTime();
		this.setCreateTime(date);
		this.setUpdateTime(date);
	}

	public void setDescAndBillOfPre(String desc,int increment,int billOfPre,String userId,String presendId,boolean flag,int type){
		this.setType(type);
		this.setIncrement(increment);
		this.setId(UuidUtil.getTimeBasedUuid()+"");
		this.setIncomeOr(flag);
		long date = new Date().getTime();
		this.setPresendId(presendId);

		this.setUserId(userId);
		this.setCashCoupon(billOfPre);
		this.setCreateTime(date);
		this.setUpdateTime(date);
	}




	/*----------------------------------------------------------------------------------------------------------------------*/

	public List<CashCouponLog> cashCouponLogs(String id){
		List<CashCouponLog> cashCouponLogs = CashCouponLog.dao.find("select * from t_cash_coupon_log where user_id=" + id);
		return cashCouponLogs;
	}
}
